package com.qf.day06;

public class User {
   private String name;
    private int age;


    public String getName(){
        return  name;
    }
    public void setName(String name){
        if(name.length()<3||name.length()>10){
            System.out.println("长度不合法");
            return;
        }else {
            this.name=name;
        }
    }
    public int getAge(){
        return  age;
    }
    public void  setAge(int age){
        if(age<1 || age>200){
            System.out.println("年龄非法，使用默认值18岁");
            this.age=18;
        }else {
            this.age=age;
        }
    }
}
